// call 实现
Function.prototype.myCall = function(context) {
  if (typeof context == null) {
    context = window
  } 
  console.log(this)
  // this => fn1
  context.fn = this
  // 获取传入的参数 => 1, 2
  const args = [...arguments].slice(1)
  const result = context.fn(...args)
  delete context.fn
  return result
}

function fn1() {
  console.log('this', this)
  const obj = {
    name: 'wpw',
    age: 18
  }
}

fn1.myCall({name: 'bb'}, 1, 2)
// fn1.myCall(null,1, 2)